

<?php

/**
 * @author christian
 * @copyright 2011
 *  
 */
 

 //establecer una variable conratafisica $_LOCALHOST
$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDTour";
include_once("$ruta/star.php");
//include_once("$rut/conf/CConfig.php");


/** Datos del paquete-tour  */
 
if (!isset($_GET['default'])) {$_GET['default'] = "NULL"; }
if (!isset($_GET['servicio'])) {$_GET['servicio'] = "NULL"; }


//idTrans 	NamEmp 	FirstConEmp 	LastConEmp 	
//FaxEmp 	PhoEmp 	MaiEmp 	CodPosEmp 	
//WebPagEmp 	ClasEmp 	MEDIO_idMed 

if (!isset($_POST['idTrans'])) {$_POST['idTrans'] = "NULL"; }
if (!isset($_POST['NamEmp'])) {$_POST['NamEmp'] = "NULL"; }
if (!isset($_POST['FirstConEmp'])) {$_POST['FirstConEmp'] = "NULL"; }
if (!isset($_POST['LastConEmp'])) {$_POST['LastConEmp'] = "NULL"; }
if (!isset($_POST['FaxEmp'])) {$_POST['FaxEmp'] = "NULL"; }
if (!isset($_POST['PhoEmp'])) {$_POST['PhoEmp'] = "NULL"; }
if (!isset($_POST['MaiEmp'])) {$_POST['MaiEmp'] = "NULL"; }
if (!isset($_POST['CodPosEmp'])) {$_POST['CodPosEmp'] = "NULL"; }
if (!isset($_POST['WebPagEmp'])) {$_POST['WebPagEmp'] = "NULL"; }
if (!isset($_POST['ClasEmp'])) {$_POST['ClasEmp'] = "NULL"; }
if (!isset($_POST['MEDIO_idMed'])) {$_POST['MEDIO_idMed'] = "NULL"; }


$default=$_GET['default'];
$servicio=$_GET['servicio'];

$idTrans=$_POST['idTrans'];
$NamEmp=$_POST['NamEmp'];
$FirstConEmp=$_POST['FirstConEmp'];
$LastConEmp=$_POST['LastConEmp'];
$FaxEmp=$_POST['FaxEmp'];
$PhoEmp=$_POST['PhoEmp'];
$MaiEmp=$_POST['MaiEmp'];
$CodPosEmp=$_POST['CodPosEmp'];
$WebPagEmp=$_POST['WebPagEmp'];
$ClasEmp=$_POST['ClasEmp'];
$MEDIO_idMed=$_POST['MEDIO_idMed'];


if($default==1){ // registrar

   

                $querybasic = "insert into transporte (idTrans,NamEmp,FirstConEmp,LastConEmp,FaxEmp,PhoEmp,MaiEmp,CodPosEmp,WebPagEmp,ClasEmp,MEDIO_idMed) 
                 values ('NULL','$NamEmp','$FirstConEmp','$LastConEmp','$FaxEmp','$PhoEmp','$MaiEmp','$CodPosEmp','$WebPagEmp','$ClasEmp','$MEDIO_idMed')";
                echo $querybasic;
                $idExt = CModelo::getInstance()->insertData($querybasic);

                 //echo "<script> parent.location.href = 'CExtensiones.php?codigo=$idPackTour' </script>";
    }

else{ // actualizar
     
       
    }
    
      
if($servicio==1){
    
    if (!isset($_POST['idTrans'])) {$_POST['idTrans'] = "NULL"; }
    if (!isset($_POST['DesRes'])) {$_POST['DesRes'] = "NULL"; }
    if (!isset($_POST['CanIteRec'])) {$_POST['CanIteRec'] = "NULL"; }
    if (!isset($_POST['PriUni'])) {$_POST['PriUni'] = "NULL"; }
    if (!isset($_POST['CommSer'])) {$_POST['CommSer'] = "NULL"; }

    $idTrans =$_POST['idTrans'];
    $DesSer=$_POST['DesSer'];
    $CanIteRec=$_POST['CanIteRec'];
    $PriUni=$_POST['PriUni'];
    $CommSer=$_POST['CommSer'];
    
    $qu = "insert into transporte_has_pack_has_tour (transporte_idTrans,DesSer,CanIteRec,PriUni,CommSer,SerFlag) 
    values ('$idTrans','$DesSer','$CanIteRec','$PriUni','$CommSer','1')";
    
    $idt = CModelo::getInstance()->insertData($qu);


    
}
        
 
//include_once("$rut/elements/head.tpl");
include_once("$rut/elements/foot.tpl");


echo "<script> parent.location.href = '/viventura/MDRestaurantes/index.php' </script>"; 
       


?>